# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AndroidEnterprise.V1.Model.ManagedProperty do
  @moduledoc """
  A managed property of a managed configuration. The property must match one of the properties in the app restrictions schema of the product. Exactly one of the value fields must be populated, and it must match the property's type in the app restrictions schema.

  ## Attributes

  *   `key` (*type:* `String.t`, *default:* `nil`) - The unique key that identifies the property.
  *   `valueBool` (*type:* `boolean()`, *default:* `nil`) - The boolean value - this will only be present if type of the property is bool.
  *   `valueBundle` (*type:* `GoogleApi.AndroidEnterprise.V1.Model.ManagedPropertyBundle.t`, *default:* `nil`) - The bundle of managed properties - this will only be present if type of the property is bundle.
  *   `valueBundleArray` (*type:* `list(GoogleApi.AndroidEnterprise.V1.Model.ManagedPropertyBundle.t)`, *default:* `nil`) - The list of bundles of properties - this will only be present if type of the property is bundle_array.
  *   `valueInteger` (*type:* `integer()`, *default:* `nil`) - The integer value - this will only be present if type of the property is integer.
  *   `valueString` (*type:* `String.t`, *default:* `nil`) - The string value - this will only be present if type of the property is string, choice or hidden.
  *   `valueStringArray` (*type:* `list(String.t)`, *default:* `nil`) - The list of string values - this will only be present if type of the property is multiselect.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :key => String.t() | nil,
          :valueBool => boolean() | nil,
          :valueBundle => GoogleApi.AndroidEnterprise.V1.Model.ManagedPropertyBundle.t() | nil,
          :valueBundleArray =>
            list(GoogleApi.AndroidEnterprise.V1.Model.ManagedPropertyBundle.t()) | nil,
          :valueInteger => integer() | nil,
          :valueString => String.t() | nil,
          :valueStringArray => list(String.t()) | nil
        }

  field(:key)
  field(:valueBool)
  field(:valueBundle, as: GoogleApi.AndroidEnterprise.V1.Model.ManagedPropertyBundle)

  field(:valueBundleArray,
    as: GoogleApi.AndroidEnterprise.V1.Model.ManagedPropertyBundle,
    type: :list
  )

  field(:valueInteger)
  field(:valueString)
  field(:valueStringArray, type: :list)
end

defimpl Poison.Decoder, for: GoogleApi.AndroidEnterprise.V1.Model.ManagedProperty do
  def decode(value, options) do
    GoogleApi.AndroidEnterprise.V1.Model.ManagedProperty.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AndroidEnterprise.V1.Model.ManagedProperty do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
